<?php 
if($_POST['action'] == 'login_user')
{
	if(($_POST['username'] != '') && ($_POST['password'] != ''))
	{
		$error = loginUser($_POST['username'], $_POST['password'], $_POST['remember']);
	}
	else
	{
		if(($_POST['password'] == ''))
		{
			$error_pass = '<font class="com_txt_err">Type in password</font>';
			
		}
		if(($_POST['username'] == ''))
		{
			$error_uname = '<font class="com_txt_err">Type in username</font>';
		}
	}
	$error[0] = '<font class="com_txt_err">'.$error[0].'</font>';
	$error[1] = '<font class="com_txt_err">'.$error[1].'</font>';
}
if($_SESSION['logged'] > 0)
{include('modules/mod_users/logedin_box.php');}
else
{
$module[1]=getModTemplate(1);

if($_POST['username'])
{$username = $_POST['username'];}
else
{$username = $_SESSION['username'];}
?>
<form id="login_user" action="" method="post" enctype="multipart/form-data" name="login_user">
<?php 
$buttons = array 
(
	'0' => array 
	(	'type' => $module[1]['f_button'],
		'text' => 'Login',
		'link' => '',
		'action' => "document.getElementById('login_user').submit();",
		'submit' => '',
		'other' => '',
		'id' => '',
	),
);
if($module[1]['border'] > 0)
{ require('templates/borders/type_'.$module[1]['border'].'_top.php'); }
//echo getHeader($module[1]['header'], $module[1]['name_l'], $module[1]['name_r'], 0);
if($module[1]['border2'] > 0)
{ require('templates/borders/type_'.$module[1]['border2'].'_top.php'); }
?>
<div class="module">
	Username:<br /><input style="width:80%;" type="text" name="username" value="<?php echo $username; ?>" /><br /><?php echo $error_uname.$error[0]; ?>
	Password:<br /><input style="width:80%;" type="password" name="password" /><br /><?php echo $error_pass.$error[1]; ?>
	Remember Me: <input type="checkbox" name="remember" />
	<input type="hidden" name="action" value="login_user" />
	<?php if($module[1]['footer'] < 1){echo addButton($module[1]['button'], 'Login', '' , '' , 'submit', '', 'loginButton', 1);} ?>
</div>
<?php 
if($module[1]['border2'] > 0)
{ require('templates/borders/type_'.$module[1]['border2'].'_bot.php'); }
echo getFooter($module[1]['footer'], '', $buttons);
if($module[1]['border'] > 0)
{ require('templates/borders/type_'.$module[1]['border'].'_bot.php'); }
?>
</form>
<?php 
}
?>


